package com.nsn.vs.sdm.util.regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Utilities for Regex operation
 * 
 * @author Jeccy.Zhao
 *
 */
public class UtilRegex
{
	/**
	 * Filter digital number from the specified string
	 * 
	 * @param str
	 * @return str
	 * @throws Exception 
	 */
	public static Integer filterDigital (final String str) 
	{ 
		String regExpr = "[^0-9]+?([0-9]+).*";
		Pattern pattern = Pattern.compile(regExpr);
		Matcher matcher = pattern.matcher(str);
		
		if (matcher.matches())
		{
			return Integer.valueOf(matcher.group(1));
		}
		else 
		{
			return  null ;
		}
	}
	
}
